#include<bits/stdc++.h>
using namespace std;
const int N=5e5+10;
typedef long long ll;
ll n,m;
ll a[N];
ll max(ll x,ll y)
{
	if(x>y) return x;
	return y;
}
bool check(ll d)
{
	ll sum=0;
	for(ll i=1;i<=n;i++)
	{
		sum+=a[i]/d;
		if(sum>m)return false;
	}
	return sum<=m;
}
vector<complex<double>> generatrComplexWave(int size,double freq)
{
	vector<complex<double>> wave(size);
	for(int i=0;i<size;i++)
	{
		double phase = 2*M_PI *freq*i/size;
		wave[i]=complex<double>(cos(phase),sin(phase));
	}
	return wave;
}
void compp(const vector<complex<double>>& signal)
{
	int  N=signal.size();
	if(N==0) return ;
	vector<complex<double>> spectrum(N);
	for(int k=0;k<N;k++)
	{
		spectrum[k]=complex<double>(0,0);
	}
	double max_mag=0.0;
	for(auto&val:spectrum)
	{
		double mag=abs(val);
		if(mag>max_mag)
		{
			max_mag=mag;
		}
	}
	
}
int main()
{
	ll t;
	cin >> t;
	while(t--)
	{
		cin >> n >> m;
		for(ll i=1;i<=n;i++)
		{
			cin >> a[i];
		}
		sort(a+1,a+n+1);
		ll l=1,r=max(1,a[n]);
		while(l<r)
		{
			ll m=(l+r)/2;
			if(check(m))
			{
				r=m;
			}
			else l=m+1;
		}
		cout<<l<<endl;
	}
	vector<complex<double>> wave = generatrComplexWave(1<<3,0.25);
	compp(wave);
	return 0;
}
